package hard.最大子数组和;

import java.util.Arrays;

/**
 * @author zhengTao
 * @version 1.0
 * @description: hard.最大子数组和
 * @date 2022/11/20 11:28
 */
public class Demo53 {
    public static void main(String[] args) {

    }
    public  int maxSubArray(int[] nums) {
        for (int i = 1; i < nums.length; i++) {
            nums[i]=Math.max(nums[i],nums[i]+nums[i-1]);
        }
       return Arrays.stream(nums).max().getAsInt();
    }
}
